#include<iostream>
#include<queue>
using namespace std;

int Hash[1003] = { 0 };
queue<int> mem;

int main()
{
	int m, n;
	cin >> m >> n;
	int cnt = 0;
	while (n--)
	{
		int en;
		cin >> en;
		if (!Hash[en])
		{
			++cnt;
			mem.push(en);
			Hash[en] = 1;
			while (mem.size() > m)
			{
				int t = mem.front();
				mem.pop();
				Hash[t] = 0;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}